package com.example.ttkl.adapter;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;
import androidx.lifecycle.Lifecycle;
import androidx.viewpager2.adapter.FragmentStateAdapter;


import com.example.ttkl.bean.TextBean;

import java.util.ArrayList;
import java.util.List;

public class HomeVPTabAdapter extends FragmentStateAdapter {
    private ArrayList<Fragment> fragments;
    private List<TextBean> title;

    public HomeVPTabAdapter(@NonNull FragmentManager fragmentManager, @NonNull Lifecycle lifecycle, ArrayList<Fragment> fragments, List<TextBean> title) {
        super(fragmentManager, lifecycle);
        this.fragments = fragments;
        this.title = title;
    }


    @NonNull
    @Override
    public Fragment createFragment(int position) {
        return fragments.get(position);
    }

    @Override
    public int getItemCount() {
        return fragments.size();
    }
}
